#ifndef			__ELEMENT_HPP__
#define			__ELEMENT_HPP__

#include <vector>
#include <string>
#include "my.h"

enum			ElementRef
  {
    ID = 0,
    VS = 1,
    NR = 2
  };

const size_t		ID_SIZE = 2; // id obj
const size_t		VS_SIZE = 1; // visible flag.
const size_t		NR_SIZE = 1; // needs refresh flag

typedef unsigned char	readType;

struct			ElmInfo
{
  size_t		size;
  size_t		start;
  readType		mask;
};

class			Element
{
private:
  readType		getMask(ElmInfo elm) const;

protected:
  void*			_data; // all parts contained
  size_t		_nbParts; // nb of parts in data
  size_t		_partSize; // size of one part (bits)
  size_t		_partChars; // size of one part (bytes)
  readType		_invMask; // mask for complement
  std::vector<ElmInfo>	_elmStruct; // detail of each element of a part
public:
  void			setDim(size_t dim);
  size_t		getDim() const;
  void			memset_all();
  void			set(size_t, readType data);
  void			set(size_t num, ElementRef part, readType data);
  readType		get(size_t num, ElementRef part) const;
  readType		get(size_t num) const;
  void			dump() const;
  void			dump2() const;

  Element();
  virtual ~Element() {}
};



#endif			/* __ELEMENT_HPP__ */
